package com.lvmama.pangolin.lmm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.lvmama.pangolin.entity.CommodityConditionVO;
import com.lvmama.pangolin.entity.lmm.LMMTicketCommodity;
import com.lvmama.pangolin.lmm.service.LMMTicketCommodityService;
import com.lvmama.pangolin.mybatis.mapper.lmm.LMMTicketCommodityMapper;

@Transactional
@Service
public class LMMTicketCommodityServiceImpl implements LMMTicketCommodityService
{
    @Autowired
	private LMMTicketCommodityMapper ticketCommodityMapper;
	@Override
	public int deleteByPrimaryKey(String id, String commodityId)
	{
		return ticketCommodityMapper.deleteByPrimaryKey(id, commodityId);
	}

	@Override
	public int deleteByProdId(String productId)
	{
		return ticketCommodityMapper.deleteByProdId(productId);
	}

	@Override
	public int insert(LMMTicketCommodity record)
	{
		return ticketCommodityMapper.insert(record);
	}

	@Override
	public int insertSelective(LMMTicketCommodity record)
	{
		return ticketCommodityMapper.insertSelective(record);
	}

	@Override
	public LMMTicketCommodity selectByPrimaryKey(String id, String commodityId)
	{
		return ticketCommodityMapper.selectByPrimaryKey(id, commodityId);
	}

	@Override
	public List<LMMTicketCommodity> selectByProdId(CommodityConditionVO co)
	{
		PageHelper.startPage(co.getPage(), co.getPageSize());
		List<LMMTicketCommodity> list = ticketCommodityMapper.selectByProdId(co);
		return list;
	}

	@Override
	public List<LMMTicketCommodity> selectByProdIdAll(CommodityConditionVO co) {
		List<LMMTicketCommodity> list = ticketCommodityMapper.selectByProdId(co);
		return list;
	}

	@Override
	public int updateByPrimaryKeySelective(LMMTicketCommodity record)
	{
		return ticketCommodityMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByProdIdSelective(LMMTicketCommodity record)
	{
		return ticketCommodityMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(LMMTicketCommodity record)
	{
		return ticketCommodityMapper.updateByPrimaryKey(record);
	}

	@Override
	public LMMTicketCommodity selectByProdCommId(String productId, String commodityId) {
		return ticketCommodityMapper.selectByProdCommId(productId, commodityId);
	}

	@Override
	public void setAsLowest(String product_id, String commodity_id) {
		ticketCommodityMapper.setAsLowest(product_id,commodity_id);
	}

	@Override
	public void deleteLowest(String productId) {
		ticketCommodityMapper.deleteLowest(productId);
	}

	@Override
	public String selectCommodityId(String productId) {
		return ticketCommodityMapper.selectCommodityId(productId);
	}

	@Override
	public List<LMMTicketCommodity> getActiveCommodity(String productId) {
		return ticketCommodityMapper.getActiveCommodity(productId);
	}
}
